package com.app.team.liquid;

//============================================================================
//Name        : ForumMenu.java
//Author      : Kyle Bartush
//Version     : 0.1
//Description : List used for showing the forum category options.
//============================================================================

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

public class ForumMenu extends ListActivity {

	String forumUrls[] = { "news/", "news/community/", "48", "55", "16", "1",
			"12", "37", "46", "19", "36", "34", "44", "45", "6", "8", "10",
			"18", "7", "0" };

	String forumNames[] = { "News", "Community Headlines", "Sponsored Threads",
			"PokerStrategy.com TSL3", "Featured Threads", "General Forum",
			"Sports & Games", "TL Community", "Tech Support", "Starcraft 2",
			"Starcraft 2 Tournaments", "Starcraft 2 Strategy",
			"SC 2 Maps & Customs", "SC2 Single Player", "Brood War",
			"Brood War Tournaments", "Brood War Strategy", "Blogs",
			"Website Feedback", "Closed" };

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setTitle("Sub Forums");
		setContentView(R.layout.forumlist);
		// getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
		// WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setListAdapter(new ArrayAdapter<String>(ForumMenu.this,
				R.layout.simple_list_text, R.id.list_content, forumNames));
		// setBackgroundResource(new Color(123, 124, 251));
	}

	@Override
	protected void onListItemClick(ListView l, View v, int position, long id) {

		String url;
		String name;
		switch (position) {
		case 0:
		case 1:
			url = "http://www.teamliquid.net/";
			break;
		default:
			url = "http://www.teamliquid.net/forum/index.php?show_part=";
			break;
		}

		url += forumUrls[position];
		name = forumNames[position];
		Bundle urlBun = new Bundle();
		urlBun.putString("url", url);
		urlBun.putString("name", name);
		Intent i = new Intent(ForumMenu.this, ThreadsList.class);
		i.putExtras(urlBun);
		startActivity(i);

	}
}
